from sqlalchemy import Column
from sqlmodel import SQLModel, Field

from entity.model.common_model import DataCollectionCommunity, BaseMixin, DataCollectionBuilding, UnsignedInt, \
    DataCollectionUnit, DataCollectionRoom


# 小区表
class JiNanDataCollectionCommunity(DataCollectionCommunity, table=True):
    __tablename__ = "data_collection_community_3701"


class JiNanDataCollectionBuilding(DataCollectionBuilding, table=True):
    __tablename__ = "data_collection_building_3701"


class JiNanDataCollectionUnit(DataCollectionUnit, table=True):
    __tablename__ = "data_collection_unit_3701"

class JiNanDataCollectionRoom(DataCollectionRoom, table=True):
    __tablename__ = "data_collection_room_3701"


class JiNanDataCollectionExtra(BaseMixin, SQLModel, table=True):
    __tablename__ = "data_collection_extra_3701"
    building_id: str = Field(max_length=100, nullable=False, unique=True, description="采集到的楼栋id")
    can_sale_count: int = Field(
        sa_column=Column(UnsignedInt, comment="可售数量", default=0)
    )